﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TaskDialog;
using System.Windows;

namespace ProductKeyManager.UI
{
    public static class NewMessageBox
    {
        public static TaskDialogResults ShowYesNoDialog(Window parent, string title, string instruction, 
            string content)
        {
            try
            {
                return TaskDialogHelper.ShowDialog(parent, title, instruction, content,
                   TaskDialogButtons.Yes | TaskDialogButtons.No, TaskDialogIcon.Warning);
            }
            catch (Exception)
            {
                MessageBoxResult result = MessageBox.Show(parent, instruction + " " + content, title,
                    MessageBoxButton.YesNo, MessageBoxImage.Warning);
                if (result == MessageBoxResult.Yes)
                {
                    return TaskDialogResults.Yes;
                }
                else
                {
                    return TaskDialogResults.No;
                }
            }
        }
    }
}
